/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.connect5.intervals;

import org.jfonia.connect5.basics.BasicValueNode;
import org.jfonia.connect5.basics.BasicNode;
import org.jfonia.connect5.basics.MutableValueNode;
import org.jfonia.connect5.numerical.DoubleSumRelation;

/**
 *
 * @author Rik Bauwens
 */
public class BasicDoubleInterval extends BasicNode implements Interval
{
	protected MutableValueNode<Double> begin;
	protected MutableValueNode<Double> end;
	protected MutableValueNode<Double> difference;

	public BasicDoubleInterval()
	{
		begin = new BasicValueNode<Double>(0.0);
		end = new BasicValueNode<Double>(0.0);
		difference = new BasicValueNode<Double>(0.0);

		new DoubleSumRelation(begin, difference, end);
	}

	public Double getBegin()
	{
		return begin.getValue();
	}

	public BasicDoubleInterval setBegin(double value)
	{
		begin.setValue(value);
		return this;
	}

	public Double getEnd()
	{
		return end.getValue();
	}

	public BasicDoubleInterval setEnd(double value)
	{
		end.setValue(value);
		return this;
	}

	public Double getDifference()
	{
		return difference.getValue();
	}

	public BasicDoubleInterval setDifference(double value)
	{
		difference.setValue(value);
		return this;
	}

	public MutableValueNode<Double> getBeginNode()
	{
		return begin;
	}

	public MutableValueNode<Double> getEndNode()
	{
		return end;
	}

	public MutableValueNode<Double> getDifferenceNode()
	{
		return difference;
	}
}
